Skip to main content

ComponentTests

Vertical Bar Chart – Component test plan

Sub-components: Bar, Line, Legends, Callout, Labels

  1. Bar: bar data, bar color (single/multi colors), bar label (show/hide)
  2. Line: show/hide line, highlight data point on line and show callout
  3. Legends: show/hide legends, highlight the corresponding bar/line on legend hover
  4. Callout: Default/custom callout
  5. Labels: x-Axis labels default/rotated
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, numerical data on x-axis.Renders vertical bar chart correctlyEnzyme
- With only data prop, string data on x-axis.Renders vertical bar chart correctlyRTL
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With EnabledLegendsWrapLines set to “true”Should enable the legends to wrap lines if there is not enough space to show all legends on a single lineEnzyme
- With ShowXAxisLablesTooltip set to “true”Should truncate x axis labels and show tooltip on x axis labelsEnzyme
- With WrapXAxisLables set to “true”Should wrap x axis label valuesEnzyme
- With yAxisTickFormat set to “%d”

Should render the y-axis ticks in the format specified

Enzyme
- With HideLabels set to “true”Should hide the bar labelsEnzyme
Test 2: Basic props testing
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- onRenderCalloutPerStack prop is not givenShould not render onRenderCalloutPerStackEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is not givenShould not render onRenderCalloutPerDataPointEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount vertical bar chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount vertical bar chart and then set the some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on a barShould render callout correctly on mouseoverEnzyme
- Mouse over on a bar with customized calloutShould render customized callout on mouseoverEnzyme
Test 5: Render empty chart aria label div when chart is empty
- Vertical bar chart mounted with non-empty dataNo empty chart aria label div renderedEnzyme
- Vertical bar chart mounted with empty dataEmpty chart aria label div renderedEnzyme
Test 6: Render empty chart calling with respective to props
- prop changes: Mount vertical bar chart with empty data and then set the propsRender function should have been called 3 timesEnzyme
Test 7: [Sub-Component]: Vertical Bar
- Specify bar widthShould render the bar with the given widthRTL
- Specify bar colors (multiple)Should render the bars with the specified colorsRTL
- Specify to use a single color for all barsShould render the bars with the single specified colorRTL
- Hide the bar labelsShould render the bars with labels hiddenRTL
- Provide xAxisPadding between the barsShould render the bars with the given padding between bar's or lines in the graphE2E
- Localize the numbers of the bars with a given cultureShould render the bars with the numbers localized in the given cultureE2E
Test 8: [Sub-Component]: Line
- Specify line dataShould render line with the data providedRTL
- Hover mouse over the data pointsShould highlight the data points (No callout is rendered when we hover only on the line. Callout appears on hover over the bars only.)RTL
Test 9: [Sub-Component]: Legends
- Hide legendsShould not show any rendered legendsRTL
- Hover mouse over bar legendsShould reduce the opacity of the other bars/lines and their legendsRTL
- Hover mouse over line legendsShould reduce the opacity of the other bars/lines and their legendsRTL
Test 10: [Sub-Component]: Callout
- Hover mouse over a barShould call the handler on mouse over barRTL
- Hover mouse over a barShould show the default callout over that barRTL
- Specify custom callout and hover mouse over a barShould show the custom callout over that barRTL
- Specify custom callout and hover mouse over the lineShould not show the custom callout over that line as custom callout is rendered only on mouse over on the bars.RTL
Test 11: [Sub-Component]: x-axis labels
- Truncate x-axis labelsShould show the x-axis labels tooltip when hoveredRTL
- Rotate x-axis labelsShould rotate the x-axis labels by 45 degreesRTL
Test 12: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 13: Theme changed to Dark ThemeShould reflect theme changeRTL